//
//  BaiDuWebController.m
//  KYProject
//
//  Created by Mxxx on 2016/12/21.
//  Copyright © 2016年 Roman. All rights reserved.
//

#import "BaiDuWebController.h"
#import "NetWorkTool.h"
#import "ProgressManager.h"
@interface BaiDuWebController ()

@end

@implementation BaiDuWebController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self getBaiDu];
    // Do any additional setup after loading the view.
}
- (void)getBaiDu
{
    UIWebView *webView = [[UIWebView alloc]initWithFrame:self.view.bounds];
    [self.view addSubview:webView];
    //网络访问
    NSString *str = @"http://www.baidu.com";
    [NetWorkTool shareManager].responseSerializer = [AFHTTPResponseSerializer serializer];
    [[NetWorkTool shareManager] GET_RequestWithUrlString:str parmas:nil successBloock:^(id responseObject) {
        
        //转菊花
        [ProgressManager alertLoading];
        
        NSString *resStr = [[NSString alloc]initWithData:responseObject encoding:NSUTF8StringEncoding];
        
        [webView loadHTMLString:resStr baseURL:nil];
        [NetWorkTool shareManager].responseSerializer = [AFJSONResponseSerializer serializer];
        
        //成功后菊花消失
        [ProgressManager dismissLoading];
        
    } failureBlock:^(NSError *error) {
        if (error) {
            NSLog(@"%@",error);
        }
    }];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
